﻿using System;
using System.Windows.Data;
using AccessControl.Contracts.Models;

namespace AccessControl.Wpf.Converters
{
	class EntryStateToBoolConverter : IValueConverter
	{
		#region IValueConverter Members

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			EntryState state = (EntryState)value;
			EntryState desiredState = (EntryState)Enum.Parse(typeof(EntryState), parameter as string);
			if (state == desiredState)
				return true;

			return false;
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			return null;
		}

		#endregion
	}
}
